// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
  /**
   * 主列表
   */
  getData(params) {
    return Service.get(
      `/${ServiceName}/api/external/FBusOrderController/queryall`, { params }
    )
  },
  /**
   * 新增
   */
  addData(params) {
    store.commit('changeStatus', true)
    return Service.post(
      `/${ServiceName}/api/external/FBusOrderController/insert`, params
    )
  },
   /**
   * 编辑修改
   */
   updateDataList(params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/FBusOrderController/update`, params
    )
  },
  /**
   * 结算按钮
   */
  updateData(params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/FBusOrderController/updateOrder`, params
    )
  },
  /**
   * 根据id查询汇总
   */
  getSummaryById(id) {
    return Service.get(
      `/${ServiceName}/api/external/FBusOrderController/querybyid?id=${id}`
    )
  },
  /**
   * 根据id删除订单
   */
  deleteById(id) {
    return Service.delete(
      `/${ServiceName}/api/external/FBusOrderController/deleteId?id=${id}`
    )
  },
   /**
   * 子页面删除
   */
   deleteByIdZi(id) {
    return Service.delete(
      `/${ServiceName}/api/external/FBusOrderController/deletebyid?id=${id}`
    )
  },
  /**
   * 撤销结算
   */
  cancelData(id) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/FBusOrderController/updateStatus?id=${id}`
    )
  },
  /**
   * 获取作业类型
   */
  getRateItem(rateTypeCode) {
    store.commit('changeStatus', true)
    return Service.get(
      `/${ServiceName}/api/external/TBusOrderController/queryCode?rateTypeCode=${rateTypeCode}`
    )
  },
}
export default api